cmake_minimum_required(VERSION 3.10 FATAL_ERROR) ## 指定cmake版本

project(libbasic VERSION 1.0.0) ## 指定工程版本

set(CMAKE_CXX_STANDARD 17) ## 设置编译环境参数
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(THIRD ${PROJECT_SOURCE_DIR}/third)  ## 定义目标变量
set(home_dir ${PROJECT_SOURCE_DIR}) ## 定义目标变量

set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib) ## 设置输出目录：静态库
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib) ## 设置输出目录：动态库
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/bin) ## 设置输出目录：可执行文件
set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/output) ## 设置输出目录：默认存放库文件的目录

set(TARGET_NAME libbasic) ## 指定输出名称

add_definitions(-D_LIB)

file(GLOB_RECURSE HEADER_FILES include/libbasic/*.h ../../xcommon/*.h) ## 指定头文件
file(GLOB_RECURSE SRC_FILES src/*.cpp ../../Alg/*.c ../../xcommon/*.cpp include/libbasic/*.hpp) ## 指定源文件

include_directories(include) ## 向编译器添加头文件的搜索路径
add_library(${TARGET_NAME} STATIC ${HEADER_FILES} ${SRC_FILES})
set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 17) ## 设置目标属性
